let nums = [1,3,5,6]
var searchInsert = function(nums, target) {
    let len = nums.length 
    for(let i = 0 ;i<=len;i++){
        if(target>nums[i]){
            if(i=len){
                return len
            }
        }else if(target<=nums[i]){
            return i
        }
    }
};
let n = searchInsert(nums, 5)
console.log(n);